package com.cmnit.analysis

import com.cmnit.analysis.application._
import org.apache.log4j.Logger

object App {
  val logger: Logger = Logger.getLogger(this.getClass)

  def main(args: Array[String]): Unit = {

    // 无参数时，默认全部执行
    // 一个参数时，执行指定流程
    // 两个参数时，执行指定流程，账期时间为指定时间（yyyyMMddHH）
    var appName = ""
    var acctTime = ""
    if (args.length == 1) {
      appName = args(0)
    }
    if (args.length == 2) {
      appName = args(0)
      acctTime = args(1)
    }

    logger.info("开始加工数据")
    appName match {
      // 门架，默认账期为前一小时 测试参数：Gantry 2022032703
      case "Gantry" => GantryApplication.run(acctTime)
      // 出口，默认账期为前一小时 测试参数：ExToll 2022032703
      case "ExToll" => ExTollApplication.run(acctTime)
      // 入口，默认账期为前一小时 测试参数：ExToll 2022032703
      case "EnToll" => EnTollApplication.run(acctTime)
      // 牌识流量，默认账期为前两小时 测试参数：GantryPlate 2022032703
      case "GantryPlate" => GantryPlateApplication.run(acctTime)
      // 入口流量，默认账期为前两小时 测试参数：EnTollFlow 2022032703
      case "EnTollFlow" => EnTollFlowApplication.run(acctTime)
      // 出口流量，默认账期为前两小时 测试参数：ExTollFlow 2022032703
      case "ExTollFlow" => ExTollFlowApplication.run(acctTime)
      // 门架流量，默认账期为前两小时 测试参数：GantryFlow 2022032703
      case "GantryFlow" => GantryFlowApplication.run(acctTime)

      // 默认执行全部流程
      case _ => AllApplication.run(acctTime)
    }
  }
}
